#ifndef QUERIES_H
#define QUERIES_H

const char* TRACE_MATCH =      " select message.query('//trace[./object/method=''%s'']') as trace, "
                               "        datalength(message.query('//trace[./object/method=''CTestBusDlg::OnBnClickedButtonSend2'']')) size, "
                               " 	      message_id, "
	                             " 	      status	"
	                             " from message_queue "
	                             " where subject = 'TRACES' "
	                             " and status = 1 ";


const char* EVENTSCH_MATCH =   " select cast(format.query('/event[./set/sequence/pattern[.=''%s'']]/executable/text()') as varchar) as executable, "
	                             "        cast(format.query('/event[./set/sequence/pattern[.=''%s'']]/name/text()') as varchar) as event_name, "
	                             "        type as event_type,	"
	                             "        cast(format.query('data(/event[./set/sequence/pattern[.=''%s'']]/@severity)') as varchar) as event_severity, "
	                             "        cast(format.query('data(/event/set/sequence/pattern[.=''%s'']/@sequence)') as varchar) as seq, "
	                             "        cast(format.query('count(/event/set/sequence[./pattern[.=''%s'']]/pattern)') as varchar) as seq_size, "
                               "        cast(format.query('data(/event/set/sequence[./pattern[.=''%s'']]/@name)') as varchar) as seq_name, "
                               "        cast(format.query('/event/set/sequence/pattern[.=''%s'']/text()') as varchar(max)) as pattern "
                               " from metadata "
                               " where type = '%s' ";

const char* ACTION_MATCH = " select format.query('/action[./procedure/events/event/name=''%s'' and ./procedure/events/event/executable=''%s'']') as action, "
                           "        datalength(format.query('/action[./procedure/events/event/name=''%s'' and ./procedure/events/event/executable=''%s'']')) as size, "
                           "        * "
                           " from metadata "
                           " where type = 'ACTION' "
                           " and datalength(format.query('/action[./procedure/events/event/name=''%s'' and ./procedure/events/event/executable=''%s'']')) > 100 ";



/*
select  
	message.query('//event/executable/text()') as executable,
	message.query('//event/name/text()') as event_name,
	message.query('data(//sequence/@name)') as seq_name, 
	*
from message_queue
where subject = 'EVENTS'
and status = 0
*/

#endif